home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
EDUCNOMY
/
HERSCHEL.LZH
/
SELECTS.INC
< prev
Wrap
Text File
|
1986-12-26
|
17KB
|
506 lines
Procedure SelectH; { Select desired Herschel classes }
Var
SaveClass,SelectClass : HClassSet;
Ch : Char;
Begin { Procedure SelectH }
ClrScr;
Writeln('The Herschel classes are:');
Writeln;
HighVideo; Write(' 1'); LowVideo; Writeln(' : Bright Nebulae');
HighVideo; Write(' 2'); LowVideo; Writeln(' : Faint Nebulae');
HighVideo; Write(' 3'); LowVideo; Writeln(' : Very Faint Nebulae');
HighVideo; Write(' 4'); LowVideo; Writeln(' : Planetary Nebulae');
HighVideo; Write(' 5'); LowVideo; Writeln(' : Very Large Nebulae');
HighVideo; Write(' 6'); LowVideo;
Writeln(' : Very Compressed and Rich Clusters of Stars');
HighVideo; Write(' 7'); LowVideo;
Writeln(' : Compressed Clusters of Small and Large Stars');
HighVideo; Write(' 8'); LowVideo;
Writeln(' : Coarsely Scattered Clusters of Stars');
Writeln;
Writeln('Current selected values are:');
If ClassSet >= [1..8] Then
Writeln('All Herschel classes.')
Else
Begin { Else }
Write('Herschel class(es) ');
For Index := 1 To 8 Do
If Index In ClassSet Then
Write(ClassNames[Index],' ');
Writeln;
End; { Else }
Writeln;
SaveClass := ClassSet; { Save the current set in case we need to keep it }
If Not Expanding Then
ClassSet := [];
Write('Type single digit classes one at a time. Type "');
HighVideo; Write('Q'); LowVideo; Writeln('" to quit');
Writeln;
Write('Type your class(es) now: ');
Repeat
Repeat
Read(Kbd,Ch);
Until Upcase(Ch) In ['1'..'8','Q'];
HighVideo; Write(Ch,' ');
If Upcase(Ch) <> 'Q' Then
Begin { Then }
Case Ch Of
'1' : SelectClass := [1];
'2' : SelectClass := [2];
'3' : SelectClass := [3];
'4' : SelectClass := [4];
'5' : SelectClass := [5];
'6' : SelectClass := [6];
'7' : SelectClass := [7];
'8' : SelectClass := [8];
End; { Case }
ClassSet := ClassSet + SelectClass; { Build set of desired classes }
End; { Then }
Until Upcase(Ch) = 'Q';
If ClassSet = [] Then { User entered procedure but didn't select anything }
ClassSet := SaveClass { Restore saved class selection values }
Else
NewSelection := True; { Something was selected }
End; { Procedure SelectH }
Procedure SelectNGC;
{ This procedure allows the user to select a range of desired NGC #s. }
Begin { Procedure SelectNGC }
ClrScr;
Writeln('Currently selected NGC #s are from ',LowNGC,' to ',HighNGC);
Writeln;
AllOK := False;
NewSelection := True;
Repeat
Writeln;
Repeat
Write('Enter low NGC number: ');
{$I-} Readln(LowNGC) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
Repeat
Write('Enter high NGC number: ');
{$I-} Readln(HighNGC) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
AllOK := LowNGC <= HighNGC;
If Not AllOK Then
Begin { Then }
Write(^G); { Ring bell to alert user to entry error }
HighVideo;
Writeln('Enter the low NGC number first!');
LowVideo;
End; { Then }
Until AllOK;
End; { Procedure SelectNGC }
Procedure SelectRA;
{ This procedure allows the user to select a desired range of r.a. }
Begin { Procedure SelectRA }
ClrScr;
Write('Currently selected r.a. values are from ',LowRAHr,'h, ');
Writeln(LowRAMin,'m to ',HighRAHr,'h, ',HighRAMin,'m');
AllOK := False;
NewSelection := True;
Repeat
Writeln;
Repeat
Write('Enter low r.a. Hrs. : ');
{$I-} Readln(LowRAHr) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
Repeat
Write(' Enter Low r.a. Minutes: ');
{$I-} Readln(LowRAMin) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
Repeat
Write('Enter high r.a. Hrs. : ');
{$I-} Readln(HighRAHr) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
Repeat
Write(' Enter high r.a. minutes: ');
{$I-} Readln(HighRAMin) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
AllOK := LowRAHr <= HighRAHr;
If Not AllOK Then
Begin { Then }
Write(^G); { Ring bell to alert user to entry error }
HighVideo;
Writeln('Enter the low r.a. first!');
LowVideo;
End; { Then }
Until AllOK;
End; { Procedure SelectRA }
Procedure SelectDec;
{ Select desired range of Declination. }
Begin { Procedure SelectDec }
ClrScr;
Write('Currently selected dec. values are from ',LowDecDeg,'d, ');
Writeln(Abs(LowDecMin),'m to ',HighDecDeg,'d, ',HighDecMin,'m');
AllOK := False;
NewSelection := True;
Repeat
Writeln;
Repeat
Write('Enter low Dec. degrees: ');
{$I-} Readln(LowDecDeg) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
Repeat
Write(' Enter low Dec. minutes: ');
{$I-} Readln(LowDecMin) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
Repeat
Write('Enter high Dec. degrees: ');
{$I-} Readln(HighDecDeg) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
Repeat
Write(' Enter high Dec. minutes: ');
{$I-} Readln(HighDecMin) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
AllOK := LowDecDeg <= HighDecDeg;
If Not AllOK Then
Begin { Then }
Write(^G); { Ring bell to alert user to entry error }
HighVideo;
Writeln('Enter the low declination first!');
LowVideo;
End; { Then }
Until AllOK;
End; { Procedure SelectDec }
Procedure SelectMag;
{ Select a desired range of magnitude. }
Begin { Procedure SelectMag }
ClrScr;
Write('Currently selected mag. values are from ');
Writeln(LowMag / 10:4:1,' to ',HighMag / 10:4:1);
AllOK := False;
NewSelection := True;
Repeat
Writeln;
Repeat
Write('Enter low (bright) magnitude: ');
{$I-} Readln(LowMag) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
LowMag := LowMag * 10;
Repeat
Write('Enter high (faint) magnitude: ');
{$I-} Readln(HighMag) {$I+};
OK := (IoResult = 0);
If Not OK Then
Write(^G); { Ring bell to alert user to entry error }
Writeln;
Until OK;
HighMag := HighMag * 10;
AllOK := LowMag <= HighMag;
If Not AllOK Then
Begin { Then }
Write(^G); { Ring bell to alert user to entry error }
HighVideo;
Writeln('Enter the low magnitude first!');
LowVideo;
End; { Then }
Until AllOK;
End; { Procedure SelectMag }
Procedure SelectType;
{ Select desired object types. }
Var
SaveTypes,SelectType : HTypeSet;
Ch : Char;
Begin { Procedure SelectType }
ClrScr;
Writeln('Object types are:');
Writeln;
HighVideo; Write(' O'); LowVideo; Writeln('pen Clusters');
Write(' Globular '); HighVideo; Write('C'); LowVideo; Writeln('lusters');
HighVideo; Write(' D'); LowVideo; Writeln('iffuse Nebulae');
HighVideo; Write(' P'); LowVideo; Writeln('lanetary Nebulae');
HighVideo; Write(' G'); LowVideo; Writeln('alaxies');
Write(' Clusters'); HighVideo; Write('/'); LowVideo; Writeln('Nebulae');
HighVideo; Write(' N'); LowVideo; Writeln('onexistant');
Writeln;
Writeln('Currently selected object types are:');
If TypeSet >= [1..7] Then
Writeln('All object types.')
Else
Begin { Else }
Write('Object type(s) ');
For Index := 1 To 7 Do
If Index In TypeSet Then
Write(ObjectTypes[Index],' ');
Writeln;
End; { Else }
Writeln;
Write('Type single characters for types one at a time. Type "');
HighVideo; Write('Q'); LowVideo; Writeln('" to quit.');
Writeln;
SaveTypes := TypeSet; { Save current value for possible restoring }
Writeln;
If Not Expanding Then
TypeSet := [];
Write('Type your object class(es) now: ');
Repeat
Repeat
Read(Kbd,Ch);
Until Upcase(Ch) In ['O','G','P','D','C','U','N','/','Q'];
HighVideo; Write(Ch,' ');
If Upcase(Ch) <> 'Q' Then
Begin { Then }
Case Ch Of
'O','o' : SelectType := [1];
'C','c' : SelectType := [2];
'D','d' : SelectType := [3];
'P','p' : SelectType := [4];
'G','g' : SelectType := [5];
'/' : SelectType := [6];
'N','n' : SelectType := [7];
End; { Case }
TypeSet := TypeSet + SelectType; { Build set of desired types }
End; { Then }
Until Upcase(Ch) = 'Q';
If TypeSet = [] Then { User enterd procedure but didn't select anything }
TypeSet := SaveTypes { Restore saved type selection values }
Else
NewSelection := True; { Something was selected }
End; { Procedure SelectType }
Procedure SelectCon;
{ Select desired constellations. }
Const
Arrow = '->';
Var
FunKey,AllSelected,SelfDeleted,ChangeInArray : Boolean;
HoldCons : Array[Cons] Of Boolean;
ConArrayIndex,X,Y,Row,Column : Byte;
Index : Cons;
Procedure Beep; { Make a sound when the arrow is moved }
Begin { Procedure Beep }
Sound(1000);
Delay(3);
NoSound;
End; { Procedure Beep }
Procedure AddCon;
{ The user typed a "+" - so add the constellation to the desired list.
The Constel array flags the desired constellations for comparison in
procedure Inp. }
Begin { Procedure AddCon }
Beep;
Constel[Index] := True;
Write(Names[Index]);
End; { Procedure AddCon }
Procedure RemoveCon;
{ The user typed a "-", so we remove the constellation from consideration. }
Begin { Procedure RemoveCon }
Beep;
Constel[Index] := False;
LowVideo;
Write(Names[Index]);
HighVideo;
End; { Procedure RemoveCon }
Procedure EraseArrow;
{ This procedure erases the "->" at each new move. }
Begin { Procedure EraseArrow }
Beep;
GoToXY(X,Y);
Write(' ');
End; { Procedure EraseArrow }
Procedure GetArrow;
{ The user typed an arrow (cursor control) key - find which one & respond }
Begin { Procedure GetArrow }
If KeyPressed Then
Begin { Then }
FunKey := True;
Read(Kbd,Ch); { Get 2nd character of extended code }
End; { Then }
If FunKey Then
Begin { Then }
FunKey := False;
Case Ch Of
#81 : Ch := 'a'; { # 81 is 'Q' and we don't want to quit }
#75 : Begin { Case Left }
EraseArrow;
X := X - 5;
Index := Index - 1;
If X < 10 Then
Begin { Then }
X := 60;
Index := Index + 11;
End; { Then }
End; { Case Left }
#77 : Begin { Case Right }
EraseArrow;
X := X + 5;
Index := Index + 1;
If X > 60 Then
Begin { Then }
X := 10;
Index := Index - 11;
End; { Then }
End; { Case Right }
#72 : Begin { Case Up }
EraseArrow;
Y := Y - 2;
Index := Index - 11;
If Y < 1 Then
Begin { Then }
Y := Y + 16;
Index := Index + 88;
End; { Then }
End; { Case Up }
#80 : Begin { Case Down }
EraseArrow;
Y := Y + 2;
Index := Index + 11;
If Y > 17 Then
Begin { Then }
Y := Y - 16;
Index := Index - 88;
End; { Then }
End; { Case Down }
End; { Case }
End; { Then }
End; { Procedure GetArrow }
Procedure WriteConScreen; { Write the constellation selection screen }
Begin { Procedure WriteConScreen }
ClrScr;
Writeln;
For Row := 0 To 7 Do { Nested FOR loop to write Con. names in order }
Begin { For Row }
Tab(11);
For Column := 1 To 11 Do
Begin { For Column }
LowVideo;
If Constel[11 * Row + Column] Then
HighVideo;
Write(Names[11 * Row + Column],' ');
End; { For Column }
Writeln; Writeln;
End; { For Row }
LowVideo;
Writeln;
Tab(18); Writeln('Position arrow with cursor control keys.');
Writeln;
Tab(16); Write('Add with "'); HighVideo; Write('+');
LowVideo; Write('", delete with "'); HighVideo; Write('-');
LowVideo; Write('". Quit with "'); HighVideo; Write('Q');
LowVideo; Writeln('".');
Writeln;
Tab(19); Write('Add all with "'); HighVideo; Write('A');
LowVideo; Write('", delete all with "'); HighVideo; Write('D');
LowVideo; Writeln('"');
HighVideo;
End; { Procedure WriteConScreen }
Procedure AddAll; { Add all constellations into consideration. This makes
it easier to add all but a few constellations. }
Begin { Procedure AddAll }
Beep;
Constel := TrueConArray; { All constellations selected }
WriteConScreen;
End; { Procedure AddAll }
Procedure DeleteAll; { Remove all constellations from consideration }
Begin { Procedure DeleteAll }
Beep;
For ConArrayIndex := 0 To NumberOfConstellations Do
Constel[ConArrayIndex] := False;
WriteConScreen;
End; { Procedure DeleteAll }
Begin { Procedure SelectCon }
{ Here is the logic at the heart of the SelectCon routine. }
SelfDeleted := True; { Program will delete all if all cons. are selected }
For Index := 0 To NumberOfConstellations Do { Loop to check selections }
If Not Constel[Index] Then { Not every con. was selected }
SelfDeleted := False;
If SelfDeleted Then { Delete all & prepare for fresh selection }
For Index := 0 To NumberOfConstellations Do { Delete all }
Constel[Index] := False;
HoldCons := Constel; { Save Constel array for comparing at proc. end }
FunKey := False; { No numeric keypad key has been pressed }
Window(1,1,80,25); { Set window size to entire screen }
WriteConScreen;
X := 10; { Initial position for arrow }
Y := 2;
Index := 1; { Arrow is at Constel[1] }
Repeat
GoToXY(X,Y);
Write(Arrow);
Repeat
Read(Kbd,Ch)
Until Upcase(Ch) In ['+','-','Q','A','D',#27];
Case Ch Of
'+' : AddCon;
'-' : RemoveCon;
'A','a' : AddAll;
'D','d' : DeleteAll;
#27 : GetArrow;
End; { Case }
Until Upcase(Ch) = 'Q';
LowVideo;
ChangeInArray := False; { For checking for individual changes }
AllSelected := True; { For checking for case of all selected }
For Index := 0 To NumberOfConstellations Do { Loop to check selections }
Begin { For Index }
If Constel[Index] <> HoldCons[Index] Then
ChangeInArray := True; { Something has changed since we saved }
If Not Constel[Index] Then { Not all were selected }
AllSelected := False;
End; { For Index }
If Not (SelfDeleted And AllSelected) Then { OK to set NewSelection }
If ChangeInArray Then
NewSelection := True;
If SelfDeleted And ((Not ChangeInArray) Or AllSelected) Then
Constel := TrueConArray; { User made no selection so we restore all }
End; { Procedure SelectCon }